home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / Visual Cafe Pro v1.0 / TUTORIAL.BIN / SlideShow.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-02-25  |  4.9 KB  |  120 lines

  1. import java.applet.Applet;
  2. import java.awt.Color;
  3. import java.awt.Component;
  4. import java.awt.Container;
  5. import java.awt.Event;
  6. import java.awt.Font;
  7. import java.awt.LayoutManager;
  8. import java.net.MalformedURLException;
  9. import symantec.itools.awt.InvisibleButton;
  10. import symantec.itools.awt.WrappingLabel;
  11. import symantec.itools.lang.Context;
  12. import symantec.itools.multimedia.ImageViewer;
  13. import symantec.itools.net.RelativeURL;
  14.  
  15. public class SlideShow extends Applet {
  16.    InvisibleButton invisibleButtonPrevUnder;
  17.    InvisibleButton invisibleButtonNextUnder;
  18.    symantec.itools.multimedia.SlideShow slideShowPhotos;
  19.    ImageViewer imageViewerClicker;
  20.    InvisibleButton invisibleButtonNext;
  21.    InvisibleButton invisibleButtonPrev;
  22.    WrappingLabel wrappingLabelDesc;
  23.  
  24.    void invisibleButtonNextUnder_Action(Event event) {
  25.       this.slideShowPhotos.nextImage();
  26.    }
  27.  
  28.    void invisibleButtonPrevUnder_Action(Event event) {
  29.       this.slideShowPhotos.previousImage();
  30.    }
  31.  
  32.    void slideShowPhotos_SlideChanged(Event event) {
  33.       this.wrappingLabelDesc.setText(this.slideShowPhotos.getDescription(this.slideShowPhotos.getCurrentImageIndex()));
  34.    }
  35.  
  36.    void invisibleButtonNext_Action(Event event) {
  37.       this.slideShowPhotos.nextImage();
  38.    }
  39.  
  40.    void invisibleButtonPrev_Action(Event event) {
  41.       this.slideShowPhotos.previousImage();
  42.    }
  43.  
  44.    public void init() {
  45.       super.init();
  46.       Context.setDocumentBase(((Applet)this).getDocumentBase());
  47.       ((Container)this).setLayout((LayoutManager)null);
  48.       ((Applet)this).resize(531, 365);
  49.       ((Component)this).setFont(new Font("Dialog", 1, 12));
  50.       ((Component)this).setForeground(new Color(0));
  51.       ((Component)this).setBackground(new Color(16777215));
  52.       this.invisibleButtonPrevUnder = new InvisibleButton();
  53.       this.invisibleButtonPrevUnder.reshape(262, 277, 37, 40);
  54.       ((Container)this).add(this.invisibleButtonPrevUnder);
  55.       this.invisibleButtonNextUnder = new InvisibleButton();
  56.       this.invisibleButtonNextUnder.reshape(305, 272, 40, 44);
  57.       ((Container)this).add(this.invisibleButtonNextUnder);
  58.       this.slideShowPhotos = new symantec.itools.multimedia.SlideShow();
  59.  
  60.       try {
  61.          this.slideShowPhotos.addImageAndDescription(RelativeURL.getURL("Images/PHOTO_1.GIF"), "Pristine Bungbusi beaches are ideal for relaxing and for all kinds of water sports, including surfing, water skiing, and snorkeling.");
  62.          this.slideShowPhotos.addImageAndDescription(RelativeURL.getURL("Images/Photo_8.gif"), "Hiking through the rainforest and touring botanical gardens are some of the many ways to explore the Bungbusi tropical paradise.");
  63.          this.slideShowPhotos.addImageAndDescription(RelativeURL.getURL("Images/PHOTO_3.GIF"), "At the top of Venduca volcano, you can safely watch the volcanic activity.");
  64.          this.slideShowPhotos.addImageAndDescription(RelativeURL.getURL("Images/Photo_7.gif"), "The ocean pounds against rocks formed from past Venduca lava flows.");
  65.          this.slideShowPhotos.addImageAndDescription(RelativeURL.getURL("Images/PHOTO_2.GIF"), "Who were the technologically advanced people that constructed this ancient Simerilian building? This riddle attracts archeologists and curious travelers from around the world.");
  66.          this.slideShowPhotos.addImageAndDescription(RelativeURL.getURL("Images/PHOTO_4.GIF"), "The extinct civilization that lived in Simerilia had indoor plumbing, running water, saunas, enclosed courtyards, and sophisticated art in their city buildings.");
  67.          this.slideShowPhotos.addImageAndDescription(RelativeURL.getURL("Images/PHOTO_5.GIF"), "The beautiful Moderna river slinks through this modern village. Portions of the river are perfect for white-water rafting.");
  68.          this.slideShowPhotos.addImageAndDescription(RelativeURL.getURL("Images/Photo_6.gif"), "Moderna rose gardens bloom year-round.");
  69.          this.slideShowPhotos.display();
  70.       } catch (Exception var2) {
  71.       }
  72.  
  73.       this.slideShowPhotos.reshape(8, 8, 337, 232);
  74.       this.slideShowPhotos.setFont(new Font("Dialog", 1, 12));
  75.       this.slideShowPhotos.setForeground(new Color(0));
  76.       this.slideShowPhotos.setBackground(new Color(16777215));
  77.       ((Container)this).add(this.slideShowPhotos);
  78.       this.imageViewerClicker = new ImageViewer();
  79.       this.imageViewerClicker.reshape(8, 256, 381, 104);
  80.       ((Container)this).add(this.imageViewerClicker);
  81.  
  82.       try {
  83.          this.imageViewerClicker.setURL(RelativeURL.getURL("Images/Clicker.gif"));
  84.       } catch (MalformedURLException var1) {
  85.       }
  86.  
  87.       this.invisibleButtonNext = new InvisibleButton();
  88.       this.invisibleButtonNext.reshape(305, 272, 40, 41);
  89.       ((Container)this).add(this.invisibleButtonNext);
  90.       this.invisibleButtonPrev = new InvisibleButton();
  91.       this.invisibleButtonPrev.reshape(264, 273, 35, 43);
  92.       ((Container)this).add(this.invisibleButtonPrev);
  93.       this.wrappingLabelDesc = new WrappingLabel();
  94.       this.wrappingLabelDesc.reshape(352, 24, 175, 212);
  95.       ((Container)this).add(this.wrappingLabelDesc);
  96.       this.wrappingLabelDesc.setText("Pristine Bungbusi beaches are ideal for relaxing and for all kinds of water sports, including surfing, water skiing, and snorkeling.");
  97.    }
  98.  
  99.    public boolean handleEvent(Event event) {
  100.       if (event.target == this.invisibleButtonPrev && event.id == 1001) {
  101.          this.invisibleButtonPrev_Action(event);
  102.          return true;
  103.       } else if (event.target == this.invisibleButtonNext && event.id == 1001) {
  104.          this.invisibleButtonNext_Action(event);
  105.          return true;
  106.       } else if (event.target == this.slideShowPhotos && event.id == 1001) {
  107.          this.slideShowPhotos_SlideChanged(event);
  108.          return true;
  109.       } else if (event.target == this.invisibleButtonPrevUnder && event.id == 1001) {
  110.          this.invisibleButtonPrevUnder_Action(event);
  111.          return true;
  112.       } else if (event.target == this.invisibleButtonNextUnder && event.id == 1001) {
  113.          this.invisibleButtonNextUnder_Action(event);
  114.          return true;
  115.       } else {
  116.          return super.handleEvent(event);
  117.       }
  118.    }
  119. }
  120.